home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / catD / unmap.z / unmap
Encoding:
Text File  |  2002-10-03  |  5.3 KB  |  133 lines

  1.  
  2.  
  3.  
  4. uuuunnnnmmmmaaaapppp((((DDDD2222XXXX))))                                                          uuuunnnnmmmmaaaapppp((((DDDD2222XXXX))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _uuuu_nnnn_mmmm_aaaa_pppp - support virtual unmapping for memory-mapped device
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>>
  13.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_mmmm_mmmm_aaaa_nnnn_...._hhhh_>>>>
  14.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_dddd_dddd_iiii_...._hhhh_>>>>
  15.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_kkkk_ssss_yyyy_ssss_////_dddd_dddd_mmmm_aaaa_pppp_...._hhhh_>>>>
  16.  
  17.      _iiii_nnnn_tttt _p_r_e_f_i_x_uuuu_nnnn_mmmm_aaaa_pppp_((((_dddd_eeee_vvvv______tttt _d_e_v_,,,, _vvvv_hhhh_aaaa_nnnn_dddd_llll______tttt _****_v_t_))))_;;;;
  18.  
  19.    AAAArrrrgggguuuummmmeeeennnnttttssss
  20.      _d_e_v  Device whose memory is to be mapped.
  21.  
  22.      _v_t   Handle to caller's virtual address space
  23.  
  24. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  25.      To unmap a device, the user program calls _mmmm_uuuu_nnnn_mmmm_aaaa_pppp(2) system call.  After
  26.      performing device-independent unmapping in the user's space, the _mmmm_uuuu_nnnn_mmmm_aaaa_pppp
  27.      system call calls the driver's _p_r_e_ffff_iiii_xxxx_uuuu_nnnn_mmmm_aaaa_pppp to remove the mapping.
  28.  
  29.    RRRReeeettttuuuurrrrnnnn VVVVaaaalllluuuueeeessss
  30.      On success, 0 is returned. An error number is returned on failure.
  31.  
  32. UUUUSSSSAAAAGGGGEEEE
  33.      If a driver provides a _mmmm_aaaa_pppp(D2X) routine but does not provide an unmapping
  34.      routine, the _mmmm_uuuu_nnnn_mmmm_aaaa_pppp system call returns the _E_N_O_D_E_V error condition to the
  35.      user.  Therefore, it is a good idea for all drivers to provide a dummy
  36.      unmapping routine even if your driver does not need to perform any action
  37.      to unmap the device.
  38.  
  39.    SSSSyyyynnnncccchhhhrrrroooonnnniiiizzzzaaaattttiiiioooonnnn CCCCoooonnnnssssttttrrrraaaaiiiinnnnttttssss
  40.      The _uuuu_nnnn_mmmm_aaaa_pppp routine has user context and can sleep.
  41.  
  42.      There are significant restrictions imposed on _u_n_m_a_p routines that affect
  43.      drivers that perform their own synchronization. When the _u_n_m_a_p function
  44.      is called, the address space for the process that is doing the call is
  45.      locked. When an address space is locked, no other mapping or unmapping
  46.      can take place and NO page faults can be serviced for the process. This
  47.      can cause problems if the process is multi-threaded - one thread can be
  48.      attempting to unmap the device and another thread can be accessing the
  49.      driver through some other entry point (e.g. _i_o_c_t_l).  If the thread that
  50.      is accessing the driver via _i_o_c_t_l locks a driver specific lock, and then
  51.      calls e.g. _cccc_oooo_pppp_yyyy_iiii_nnnn, and if the data to be copied in causes a page fault,
  52.      then the page fault code will attempt to lock the address space lock. If,
  53.      at the same time, another thread is attempting to _u_n_m_a_p the device, and
  54.      the _u_n_m_a_p routine grabs the driver lock, an AB-BA deadlock can occur
  55.      which will require re-booting the system to clear.  The safest way around
  56.      this is to make sure that the driver never calls _cccc_oooo_pppp_yyyy_iiii_nnnn or _cccc_oooo_pppp_yyyy_oooo_uuuu_tttt while
  57.      holding a driver lock and is used by the _u_n_m_a_p routine.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. uuuunnnnmmmmaaaapppp((((DDDD2222XXXX))))                                                          uuuunnnnmmmmaaaapppp((((DDDD2222XXXX))))
  71.  
  72.  
  73.  
  74. RRRREEEEFFFFEEEERRRREEEENNNNCCCCEEEESSSS
  75.      _mmmm_aaaa_pppp(D2X), _vvvv______gggg_eeee_tttt_aaaa_dddd_dddd_rrrr(D3X), _vvvv______gggg_eeee_tttt_llll_eeee_nnnn(D3X), _vvvv______gggg_eeee_tttt_hhhh_aaaa_nnnn_dddd_llll_eeee(D3X), _vvvv______mmmm_aaaa_pppp_pppp_hhhh_yyyy_ssss(D3X)
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.